gtk: Keep Firefox working in the DrawingContext world
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 22 Jun 2016 09:56:27 +0000 (10:56 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 22 Jun 2016 10:41:59 +0000 (11:41 +0100)
commit40ee61a686826ac8e937af720bc152895b10392b
treebcccb48785f8507fbcdf289958516e1ef9b32e5f
parentc2ba9ca810cd70658d8cc9839693b9518824d4be
gtk: Keep Firefox working in the DrawingContext world

Firefox does a bunch of interesting things with GTK.

If the top-level GtkWindow does not have a "csd" style class associated,
Firefox will happily draw the contents of the container used to render
HTML and XUL directly on the top level's GdkWindow; on the other hand,
if a "csd" style class is found, the MozContainer will create a new
child window, and draw on it.

Then, Firefox will proceed to disable double buffering on both the
top-level window and the MozContainer (unless they are backed by the
same GdkWindow, in which case only the top-level will be
single-buffered) *and* it will add a GDK_EXPOSURE_MASK flag to the
MozContainer events for good measure (even if this is only needed for
GTK+ 2.x).

After landing the GdkDrawingContext API in GdkWindow, GTK enabled
automatic double buffering on all top-level windows backed by a native
surface, ad most users of single buffering rely on child widgets instead
of top-levels, and we'd still like to have the same double buffering
behaviour for all top-levels on all backends. Obviously, with Firefox
disabling double buffering on the top-level window, the change broke
their drawing mechanism.

Ideally, Firefox could be fixed to not disable double buffering on the
top-level window when MozContainer has a separate GdkWindow — i.e. the
CSD case — but since we did introduce a slight change of behaviour in
fringe users of the GTK+ API, let's keep backwards compatibility with
the old code for a little while longer, and create an intermediate Cairo
context unbound from the GdkDrawingContext, like we used to do until
GTK+ 3.20.
gtk/gtkwidget.c